<?php


namespace App\Transformers\Wechat;


use League\Fractal\TransformerAbstract;

class WechatMessageTransFormer extends TransformerAbstract
{
    public function transform($data)
    {
        return [
            'id' => $data->id,
            'openid' => $data->openid ?? '',
            'user_id' => $data->user_id ?? '',
            'type' => $data->type ?? '',
            'content' => $data->content ?? '',
            'use_time' => $data->use_time ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];

    }

}
